package com.nbjtjc.safe.service.sys;

import com.nbjtjc.safe.bean.Result;
import com.nbjtjc.safe.mapper.sys.SysTeamMapper;
import com.nbjtjc.safe.model.sys.SysTeam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @auther guqianbin
 * @date 2018/6/21 9:26
 **/
@Service
public class SysTeamService {
    @Autowired
    private SysTeamMapper sysTeamMapper;

    public Result find(SysTeam sysTeam){
        Result result=new Result();
        List<SysTeam> sysTeams=sysTeamMapper.search(sysTeam);
        result.setData(sysTeams);
        return result;
    }

    public Result add(SysTeam sysTeam){
        Result result=new Result();
        sysTeamMapper.insertSelective(sysTeam);
        result.setData(sysTeam);
        return result;
    }

    public Result delete(SysTeam sysTeam){
        Result result=new Result();
        sysTeam.setDelFlag(-1);
        sysTeamMapper.updateByPrimaryKeySelective(sysTeam);
        return result;
    }

    public Result update(SysTeam sysTeam){
        Result result=new Result();
        sysTeamMapper.updateByPrimaryKeySelective(sysTeam);
        result.setData(sysTeam);
        return result;
    }

}
